import http from '@/axios'
import {handleError} from "vue";
import {handleSuccess} from "@/api/index.js";

export const operateCaseApi={
    //获取案件列表
    getCaseList(data){
        return http.post('/api/cases/list',data)
        .then(res => handleSuccess(res, '获取案件列表成功'))
        .catch(error => handleError(error, '获取案件列表失败', '服务器异常'));
    },
    //获取案件详情
    getCaseDetail(caseNo){
        return http.get('/api/cases/detail',{params:{caseNo}})
        .then(res => handleSuccess(res, '获取案件详情成功'))
        .catch(error => handleError(error, '获取案件详情失败', '服务器异常'));
    },
    //导出案件材料为excel
    exportCaseMaterial(case_no){ 
        return http.get('/api/export',{params:{case_no}})
        .then(res => handleSuccess(res, '导出案件材料成功'))
        .catch(error => handleError(error, '导出案件材料失败', '服务器异常'));
    },

}
